package com.neuedu.curd.controller;


import com.neuedu.curd.entity.User;
import com.neuedu.curd.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/rest")
public class MyRestController {

    @Autowired
    UserService userService;

    /**
     * http://127.0.0.1:8080/springmvc/rest/get/2
     * @param id
     * @return
     */
    @RequestMapping("/get/{id}")
//    @ResponseBody
    public User  toEdid(@PathVariable(value="id") Integer id){

        User user = userService.queryById(id);

        return user;
    }


    /**
     *  http://127.0.0.1:8080/springmvc/rest    /user/a/createUser
     *  http://127.0.0.1:8080/springmvc/rest    /user/b/createUser
     *  http://127.0.0.1:8080/springmvc/rest    /user/c/createUser
     *
     *  /user/createUser??    /user/createUserb  
     * @return
     */
    @RequestMapping("/user/*/createUser")
    public String m1(){
        return "";
    }
}
